
namespace BlazorSystem
{
    public class ServerService : BackgroundService
    {
        private readonly ILogger<ServerService> _logger;

        public ServerService(ILogger<ServerService> logger)
        {
            _logger = logger;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            YZZ.Logger.Instance.Log("Executed");
            KeyValuePair<Task, CancellationToken> item = BlazorSystem.Program.StartOutside(BlazorSystem.Program.OutSideArgs);
            while (!stoppingToken.IsCancellationRequested)
            {
                YZZ.Logger.Instance.Log("running");
                //_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
                await Task.Delay(1000, stoppingToken);
            }
            YZZ.Logger.Instance.Log("Done");
            BlazorSystem.Program.StopOutside();

        }
    }
}